package com.hzlx.routes.service.impl;

import java.util.List;

import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.hzlx.routes.mapper.ProcessRoutesMapper;
import com.hzlx.routes.domain.ProcessRoutes;
import com.hzlx.routes.service.IProcessRoutesService;

/**
 * 工艺路线Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-01
 */
@Service
public class ProcessRoutesServiceImpl implements IProcessRoutesService 
{
    @Autowired
    private ProcessRoutesMapper processRoutesMapper;
    @Resource
    private RedisTemplate<String, Object> redisTemplateObject;
    String KEY = "base-data-service:process_routers";
    /**
     * 查询工艺路线
     * 
     * @param routeId 工艺路线主键
     * @return 工艺路线
     */
    @Override
    public ProcessRoutes selectProcessRoutesByRouteId(Long routeId)
    {
        return processRoutesMapper.selectProcessRoutesByRouteId(routeId);
    }

    /**
     * 查询工艺路线列表
     * 
     * @param processRoutes 工艺路线
     * @return 工艺路线
     */
    @Override
    public List<ProcessRoutes> selectProcessRoutesList(ProcessRoutes processRoutes)
    {
        List<ProcessRoutes> list = processRoutesMapper.selectProcessRoutesList(processRoutes);
        redisTemplateObject.opsForValue().set(KEY,list);
        return list;
    }

    @Override
    public List<ProcessRoutes> selectProcessRoutesProductsList(ProcessRoutes processRoutes) {
        return processRoutesMapper.selectProcessRoutesProductsList(processRoutes);
    }

    /**
     * 新增工艺路线
     * 
     * @param processRoutes 工艺路线
     * @return 结果
     */
    @Override
    public int insertProcessRoutes(ProcessRoutes processRoutes)
    {
        return processRoutesMapper.insertProcessRoutes(processRoutes);
    }

    /**
     * 修改工艺路线
     * 
     * @param processRoutes 工艺路线
     * @return 结果
     */
    @Override
    public int updateProcessRoutes(ProcessRoutes processRoutes)
    {
        return processRoutesMapper.updateProcessRoutes(processRoutes);
    }

    /**
     * 批量删除工艺路线
     * 
     * @param routeIds 需要删除的工艺路线主键
     * @return 结果
     */
    @Override
    public int deleteProcessRoutesByRouteIds(Long[] routeIds)
    {
        return processRoutesMapper.deleteProcessRoutesByRouteIds(routeIds);
    }

    /**
     * 删除工艺路线信息
     * 
     * @param routeId 工艺路线主键
     * @return 结果
     */
    @Override
    public int deleteProcessRoutesByRouteId(Long routeId)
    {
        return processRoutesMapper.deleteProcessRoutesByRouteId(routeId);
    }
}
